class ImageAnalyser{

	protected $site;
	protected $imagedir;
	protected $httpdir;
	function __construct(){
	$this->site="http://www.vectorworks.be";
	$this->imagedir = "/opt/www/designexpress/web/www.vectorworks.be/images";
	$this->httpdir ="http://www.vectorworks.be/images/";
	}


	function get_404(){
		$pdo = new DB_Pdo('vandersanden'); // new pdo object
		$result = $pdo->prepare('select id,crawlid,url from crawler_images where exist = 2');
		$result->execute();
		$pagesarray = $result->fetchAll(PDO::FETCH_ASSOC);

		foreach ($pagearray as $page404){
		$crawlid = $page404['crawlid'];
		$result = $pdo->prepare('select url from crawler where id = :crawlid');
		$result->bindParam(':crawlid',$crawlid,PDO::PARAM_INT);
		$result->execute();
		$urlarray = $result->fetch(PDO::FETCH_ASSOC);
		echo $page404['url'];
		print_r($urlarray);
		}
		$result = null;
		$pdo = null;

	}
	function images_on_server(){
		$dirname = "/opt/www/designexpress/web/www.designexpress.be/";
		$return = array();
		$dir = opendir($this->imagedir);
		while(false != ($file = readdir($dir))){
			if(($file != ".") and ($file != "..")){array_push($return,$this->httpdir.$file);}
		}
		foreach($return as $imgurl){
			echo $imgurl,"-";
			$pdo = new DB_Pdo('vandersanden'); // new pdo object
			$result = $pdo->prepare('select id,url from crawler_images where url = :imgurl');
			$result->bindParam(':imgurl',$imgurl,PDO::PARAM_STR);
			$result->execute();
			$pagesarray = $result->fetch(PDO::FETCH_ASSOC);
			$pdo = null;
			$result = null;
			if(isset($pagesarray)){print_r($pagesarray);echo "\n";}else{echo 'not set:';print_r($pagesarray);echo".\n"; }
		}
	}


}